package com.miya.demo.support.listener.event;

import cn.hutool.json.JSONUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.event.EventListener;
import org.springframework.stereotype.Component;

/**
 * spring event demo 监听器
 *
 * @author CaiXiaowei
 * @date 2022/12/5
 */
@Component
@Slf4j
public class DemoEventListener {

    @EventListener
    public void test(DemoEvent demoEvent) {

        log.info("spring event demo 监听器: {}, thread:{}", JSONUtil.toJsonStr(demoEvent), Thread.currentThread().getName());
    }

    @EventListener
    public void test2(DemoEvent demoEvent) {
        log.info("spring event demo2 监听器: {}, thread:{}", JSONUtil.toJsonStr(demoEvent), Thread.currentThread().getName());
    }
}
